<template>
  <div>
    <h1 style="color:#fff;">文件下载demo</h1>
    <a @click="downloadWithParams" style="color:#fff; display:block; background-color: #ffd04b; width: 180px;">1. download with params</a>
    <br />
    <a @click="downloadWithoutParams" style="color:#fff; display:block; background-color: #ffd04b; width: 206px;">2. download without params</a>
  </div>
</template>

<script>
export default {
  name: "fileDownloadDemo",
  data() {
    return {
      testParam1: "test1",
      fileName: "nice.txt"
    };
  },

  methods: {
    downloadWithParams: function() {
      this.$api.file.downloadFile(this.fileName, {
        testParam1: this.testParam1
      });
    },
    downloadWithoutParams: function() {
      this.$api.file.downloadFile(this.fileName, {});
    }
  }
};
</script>
